from django.test import TestCase
from .models import TableModel

class TableModelTestCase(TestCase):

    def setUp(self):
        data_list = list()
        batch = 10
        for i in range(batch):
            data_list.append(TableModel(char_field=f'char-{i}', integer_field=1))
            pass
        TableModel.objects.bulk_create(data_list, batch)
        count = TableModel.objects.count()
        self.assertEqual(count, batch)
        pass

    def test_filter(self):
        qs = TableModel.objects.filter(integer_field=1)
        self.assertNotEqual(qs.count(), 0)
        pass

    pass
